package test.demo;

/***
 ** @category 接口隔离-示例一
 ** @author qing.yunhui
 ** @email: qingyh@glodon.com
 ** @createTime: 2021-12-30 13:51
 **/
public class InterfaceIsolation {
    public static void main(String[]args){
        IAnimal dog = new Dog();
        dog.eat();
        dog.fly();
        dog.walk();
        dog.swim();
        IAnimal bird = new Bird();
    }
}
/**
 * <p>定义动物行为接口</p>
 */
interface  IAnimal{
    void eat();
    void fly();
    void walk();
    void swim();
}
class Dog implements IAnimal{
    @Override
    public void eat() { System.out.println("小狗在吃汉堡"); }
    @Override
    public void fly() { System.out.println("小狗在天上飞"); }
    @Override
    public void walk() { System.out.println("小狗在地上走"); }
    @Override
    public void swim() { System.out.println("小狗在水里游"); }
}
class Bird implements IAnimal{
    @Override
    public void eat() { }
    @Override
    public void fly() { }
    @Override
    public void walk() { }
    @Override
    public void swim() { }
}

